<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_CSS选择器</title>
    <style>
        #d1 {
            width: 100px;
            height: 10px;
            background: lawngreen;
        }
        .msg{
            color: white;
        }

        .error{
            background: red;
        }

        .success{
            background: green;
        }
        a:link{
            color: gray;
        }
        a:visited{
            color: green;
        }
        a:hover{
            color:orange;
        }
        a:active{
            color: red;
        }

        #d1:hover{
            background: red;
        }

        h4,#d1,.error{
            border:5px solid green;
        }

        #d2 span{
            background: red;
        }
        #d2>div>p>span{
            color: white;
        }
        #d2*{
            color: red;
        }

    </style>
</head>
<body>
<div id="d1">我是div</div>
<div>我是div</div>
<div>我是div</div>

<p>我是段落</p>
<p>我是段落</p>
<p>我是段落</p>

<h4>我是标题</h4>
<h4 >我是标题</h4>
<h4>我是标题</h4>

<hr>
<span class="error msg ">用户名被占用</span>
<span class="error msg ">用户名被占用</span>
<span class="error msg ">用户名被占用</span>
<span class="success msg ">用户名被占用</span>
<span class="success msg ">用户名被占用</span>
<span class="success msg ">用户名被占用</span>
<span class="success msg ">用户名被占用</span>
<span class="error msg ">用户名被占用</span>

<hr>
<a href="http://www.91.com">超链接</a>
<a href="http://">超链接1</a>


<div id="d2">
    <span>111</span>
    <div>
        <span>222</span>
        <p>测试文字</p>
        <p>测试<span>333</span></p>
    </div>
    <span>444</span>
</div>

</body>
</html>